﻿//-----------------------------------------------------------------------
// <copyright file="CoreDependencyRegistry.cs" company="OverrideThis">
//     Copyright (c) 2010 OverrideThis.com
// </copyright>
//-----------------------------------------------------------------------
namespace OverrideThis.Core.Infrastucture.IoC
{
    using OverrideThis.Core.Infrastucture.Mapper;
    using OverrideThis.Core.Infrastucture.Mapper.Impl;
    using OverrideThis.Core.Services;
    using StructureMap.Configuration.DSL;

    public class CoreDependencyRegistry : Registry
    {
        public CoreDependencyRegistry()
        {
            this.Scan(
                scan =>
                {
                    scan.AssemblyContainingType<IService>();
                    scan.WithDefaultConventions();
                });

            this.For<IMapper>()
                .Use(ctx => new AutoMapperProxy());

            For<MapperAttribute>()
                .Use<MapperAttribute>()
                .Setter<IMapper>()
                .IsTheDefault();

        }
    }
}
